package com.zdyg.inputtask.project.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zdyg.inputtask.project.entity.SysUser;
import com.zdyg.inputtask.project.mapper.SysUserMapper;
import com.zdyg.inputtask.project.service.ISysUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;

/**
 * <p>
 * 用户信息表 服务实现类
 * </p>
 *
 * @author ANGE
 * @since 2019-12-11
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {

    @Autowired
    private HttpSession session;
    @Autowired
    private SysUserMapper sysUserMapper;
    @Override
    public boolean loginUser(String phone) {
        SysUser sysUser = sysUserMapper.selectOne(new QueryWrapper<SysUser>().eq("phone",phone));
        if(sysUser!=null){
            session.setAttribute("sysUser",sysUser);
            System.out.println(sysUser);
            return true;
        }
        return false;
    }
}
